﻿using Xtensive.Orm;
using Xtensive.Orm.Configuration;

namespace Xtensive.Orm.Web
{
  /// <summary>
  /// Builds <see cref="Domain"/> based on application configuration file
  /// </summary>
  public static class DomainBuilder
  {
    /// <summary>
    /// Builds the default <see cref="Domain"/>.
    /// </summary>
    public static Domain Build()
    {
      return Build("Default");
    }

    /// <summary>
    /// Builds the <see cref="Domain"/> with the specified name.
    /// </summary>
    public static Domain Build(string name)
    {
      var config = DomainConfiguration.Load(name);
      var domain = Domain.Build(config);
      return domain;
    }
  }
}